package yong.hee;

import android.app.*;
import android.content.*;
import android.content.res.*;
import android.os.*;
import android.view.*;
import android.view.View.OnClickListener;
import android.widget.*;

public class NewTwit extends Activity implements OnClickListener {

	Button mButtonUpdate;
	EditText mTextStatus;
	static final String TAG = "MyTwitter";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.update_tweet);
		
		mButtonUpdate = (Button) findViewById(R.id.buttonUpdate);
		mTextStatus = (EditText) findViewById(R.id.textStatus);
		mButtonUpdate.setOnClickListener(this);
		
		if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
			mTextStatus.setMinLines(3);
			mButtonUpdate.setTextSize(22);
		}
	}
	
	public void onClick(View v) {
		Intent intent = getIntent();
		String status = mTextStatus.getText().toString();

		// Ignore empty updates
		if (status.length() == 0) return;
		intent.putExtra("new_tweet", status);
		setResult(RESULT_OK, intent);
		finish();
	}
}
